﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="AddTrainingRegister.ascx.vb"
    Inherits="WebForm_AddTrainingRegister" %>
<%@ Register Src="~/WebForm/CommonControl/UploadFileControl.ascx" TagName="UploadFileControl"
    TagPrefix="uc2" %>
<%@ Register Src="~/WebForm/CommonControl/VolunteerQueryControl.ascx" TagName="VolunteerQueryControl"
    TagPrefix="uc3" %>
<%@ Register Src="SearchVolunteerControl.ascx" TagName="SearchVolunteerControl" TagPrefix="uc1" %>
<%@ Register Src="~/WebForm/CommonControl/CalendarTextBox.ascx" TagName="CalendarTextBox"
    TagPrefix="My" %>
 
   
<style type="text/css">
    .style1
    {
        width: 100%;
    }
</style>
   <script>
Sys.Application.add_load(
 function(sender, eventArgs) {

	$('input[name*="chkAllSignIn"],input[name*="chkAllSignIn"]').click(function(){
		$('input[name*="chkSignIn"]').attr('checked', this.checked);
	});

	$('input[name*="chkAllSignOut"],input[name*="chkAllSignOut"]').click(function(){
		$('input[name*="chkSignOut"]').attr('checked', this.checked);
	});
	


});
</script>
<table width="100%">
    <tr>
        <td class="Section">
            <asp:Label ID="lblCourseInfo" runat="server" meta:resourcekey="lblCourseInfo"></asp:Label>
        </td>
    </tr>
    <tr>
        <td>
            <table width="100%">
                <tr>
                    <td align="right">
                        <asp:Label ID="lblYear" runat="server" Text="<%$ Resources:lblYear %>"></asp:Label>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlYear" runat="server" AutoPostBack="true">
                            
                        </asp:DropDownList>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblGroupType" runat="server" Text="<%$ Resources:lblGroupType %>"></asp:Label>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlGroupType" runat="server" AutoPostBack="true">
                            <asp:ListItem Text="-- 全部 --" Value=""></asp:ListItem>
                            <asp:ListItem Text="基礎訓練" Value="B"></asp:ListItem>
                            <asp:ListItem Text="特殊訓練" Value="S"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblGroupId" runat="server" Text="<%$ Resources:GroupName %>"></asp:Label>                       
                    </td>
                    <td align="left">
                         <asp:DropDownList ID="ddlGroupId" runat="server" AutoPostBack="True">
                        </asp:DropDownList>
<%--                        <asp:RequiredFieldValidator ID="chk_ddlGroupId" runat="server" ControlToValidate="ddlGroupId"
                            Display="None" InitialValue="0" ErrorMessage="<%$ Resources:GroupIdMustInput %>"
                            ValidationGroup="CheckGroup"></asp:RequiredFieldValidator>--%>
                    </td>
                    <td align="left">
                      <%--  <asp:Button ID="btnUploadFile" runat="server" Text="<%$ Resources:UploadFile %>"
                            Visible="False" ValidationGroup="CheckGroup" />--%>
                            <asp:Button ID="btnUploadFile" runat="server" Text="<%$ Resources:UploadFile %>"
                            Visible="False" />
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td align="left">
<%--                        <asp:Button ID="btnExport" runat="server" Text="<%$ Resources:Export %>" ValidationGroup="CheckGroup" />
                        <asp:Button ID="btnExport1" runat="server" Text="<%$ Resources:Export1 %>" ValidationGroup="CheckGroup" />--%>
                        <asp:Button ID="btnExport" runat="server" Text="<%$ Resources:Export %>" />
                        <asp:Button ID="btnExport1" runat="server" Text="<%$ Resources:Export1 %>" />
                        <asp:CheckBox ID="cbExportType" runat="server" Text="<%$ Resources:Type %>"/>
                    </td>
                    <td></td>
                </tr>
            </table>
            <uc2:UploadFileControl ID="UploadFileControl1" runat="server" strClass="TrainingRecord"
                isEdit="True" />
        </td>
    </tr>
</table>
<asp:FormView ID="FormView_Course" runat="server" DataSourceID="ObjectDataSource_GroupInfo"
    Width="100%">
    <ItemTemplate>
        <asp:Panel ID="Panel1" runat="server" GroupingText="<%$ Resources:GroupInfo %>">
            <table cellpadding="0" cellspacing="0" width="600">
                <tr>
                    <td align="right">
                        <asp:Label ID="lblOrg" runat="server" meta:resourcekey="lblOrg"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="txtOrg" runat="server" Text='<%# Eval("Org") %>'></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblClassPlace" runat="server" meta:resourcekey="lblClassPlace"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="txtClassPlace" runat="server" Text='<%# Eval("ClassPlace") %>'></asp:Label>
                    </td>
                </tr>
                <tr valign="bottom">
                    <td align="right">
                        <asp:Label ID="lblAllHour" runat="server" Text="<%$ Resources:AllHour %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblAllHour0" runat="server" Text='<%# Eval("AllHour") %>'></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblPersonLimit" runat="server" Text="<%$ Resources:PersonLimit %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblPersonLimit0" runat="server" Text='<%# Eval("PersonLimit") %>'></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblCandidate" runat="server" Text="<%$ Resources:Candidate %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblCandidate0" runat="server" Text='<%# Eval("Candidate") %>'></asp:Label>
                    </td>
                    <td valign="top">
                        &nbsp;
                    </td>
                    <td valign="top">
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblCountAll" runat="server" Text="<%$ Resources:CountAll %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblCountAll0" runat="server" Text='<%# Eval("AllCount") %>'></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblCountA" runat="server" Text="<%$ Resources:CountA %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblCountA0" runat="server" Text='<%# Eval("YCount") %>'></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblCountB" runat="server" Text="<%$ Resources:CountB %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblCountB0" runat="server" Text='<%# Eval("BCount") %>'></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblCountC" runat="server" Text="<%$ Resources:CountC %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblCountC0" runat="server" Text='<%# Eval("NCount") %>'></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblStartDate" runat="server" Text="<%$ Resources:StartDate %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblStartDate0" runat="server" Text='<%# Eval("StartDate","{0:d}") %>'></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblEndDate" runat="server" Text="<%$ Resources:EndDate %>"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lblEndDate0" runat="server" Text='<%# Eval("EndDate","{0:d}") %>'></asp:Label>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </ItemTemplate>
</asp:FormView>
<My:MyGridView ID="GridView_Course" runat="server" AllowHoverSelect="False" AutoGenerateColumns="False"
    MySortDirection="Ascending" SkinID="pager" AllowPaging="True" AllowSorting="True"
    AllowHoverEffect="False" DataSourceID="ObjectDataSource_CourseInfo">
    <Columns>
        <asp:BoundField DataField="CourseName" HeaderText="<%$ Resources:CourseName %>" />
        <%--        <asp:BoundField DataField="ClassPlace" HeaderText="<%$ Resources:ClassPlace %>" />--%>
        <asp:BoundField DataField="StartTime" meta:resourcekey="bfStartTime" />
        <asp:BoundField DataField="EndTime" meta:resourcekey="bfEndTime" />
        <asp:BoundField DataField="TeacherName" HeaderText="<%$ Resources:TeacherName %>" />
        <asp:BoundField DataField="Org" HeaderText="<%$ Resources:Org %>" />
        <asp:BoundField DataField="Hour" HeaderText="<%$ Resources:Hour %>" />
    </Columns>
</My:MyGridView>
<asp:ObjectDataSource ID="ObjectDataSource_GroupInfo" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="BLL_SelectGroupInfoByGroupId" TypeName="BLL_AddTrainingRegister">
    <SelectParameters>
        <asp:ControlParameter ControlID="ddlGroupId" Name="GroupId" PropertyName="SelectedValue"
            Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource_CourseInfo" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="BLL_SelectCourseInfoByGroupId" TypeName="BLL_AddTrainingRegister">
    <SelectParameters>
        <asp:ControlParameter ControlID="ddlGroupId" Name="GroupId" PropertyName="SelectedValue"
            Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>
<br />
<table width="100%">
    <tr>
        <td class="Section">
            <asp:Label ID="lblVolunteerList" runat="server" meta:resourcekey="lblVolunteerList"></asp:Label>
        </td>
    </tr>
    <tr>
        <td align="left">
            <table>
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td colspan="2">
                                    <uc3:VolunteerQueryControl ID="VolunteerQueryControl1" runat="server" />
                                </td>
                            </tr>
                                                        <tr>
                                <td colspan="2">
                                    <asp:Label ID="lblUpload" runat="server"  Text="<%$ Resources:UploadFile %>"></asp:Label>
                                    <asp:FileUpload ID="FileUpload1" runat="server" Width="300px" />
                                  <%--  <asp:Button ID="btnUpload" runat="server" Text="<%$ Resources:Upload %>" 
                                         ValidationGroup="CheckGroup"/>--%>
                                         <asp:Button ID="btnUpload" runat="server" Text="<%$ Resources:Upload %>" 
                                          />
                                    <asp:HyperLink ID="hlinklExcelUpload" Font-Size="12px" meta:resourcekey="hlinklExcelUpload"  NavigateUrl="~/Downloads/SystemFile/ImportTraningListSample.xls" runat="server"></asp:HyperLink>

                                </td>
                            </tr>
                            <asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible="False">
                                <tr>
                                    <td colspan="2">
                                        <hr />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblIssueDate" runat="server" meta:resourcekey="lblIssueDate"></asp:Label>
                                    </td>
                                    <td align="left">
                                        <My:CalendarTextBox ID="txtIssueDate" runat="server" />
                                        <%--                                        <asp:TextBox ID="txtIssueDate" runat="server"></asp:TextBox>
                                        <ajaxToolkit:CalendarExtender ID="ceIssueDate" runat="server" TargetControlID="txtIssueDate">
                                        </ajaxToolkit:CalendarExtender>
                                        <asp:RequiredFieldValidator ID="vadIssueDate2" runat="server" ControlToValidate="txtIssueDate"
                                            meta:resourcekey="vadIssueDate2" Display="None" ValidationGroup="vPrint"></asp:RequiredFieldValidator>
                                        <asp:CompareValidator ID="vadIssueDate" runat="server" ValidationGroup="vPrint" ControlToValidate="txtIssueDate"
                                            meta:resourcekey="vadIssueDate" Display="None" Operator="DataTypeCheck" Type="Date"></asp:CompareValidator>
--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblTrainingNo" runat="server" meta:resourcekey="lblTrainingNo"></asp:Label>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtTrainingNo" runat="server"></asp:TextBox>
<%--                                        <asp:RequiredFieldValidator ID="vadTrainingNo" runat="server" ControlToValidate="txtTrainingNo"
                                            meta:resourcekey="vadTrainingNo" Display="None" ValidationGroup="vPrint"></asp:RequiredFieldValidator>--%>
                                    </td>
                                </tr>
                            </asp:PlaceHolder>
                        </table>
                    </td>
                    <td valign="bottom">
                        <table>
                            <tr>
                                <td>
                                    <asp:Button ID="btnQuery" runat="server" Text="<%$ Resources:Query %>" Width="100%" />
                                </td>
                            </tr>
                            <tr>
                                <td>
<%--                                    <asp:Button ID="btnShow" runat="server" Text="<%$ Resources:ShowPerson %>" ValidationGroup="CheckGroup" />--%>
                                    <asp:Button ID="btnShow" runat="server" Text="<%$ Resources:ShowPerson %>" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                 <%--   <asp:Button ID="btnSave" runat="server" Text="<%$ Resources:Save %>" Visible="False"
                                        ValidationGroup="CheckGroup" Width="100%" />--%>
                                        <asp:Button ID="btnSave" runat="server" Text="<%$ Resources:Save %>" Visible="False"
                                         Width="100%" />   
                                </td>
                            </tr>
                            <tr>
                                <td>
                                <%--    <asp:Button ID="btnPrint" runat="server" meta:resourcekey="btnPrint" Visible="False"
                                        ValidationGroup="vPrint" />--%>
                                        <asp:Button ID="btnPrint" runat="server" meta:resourcekey="btnPrint" Visible="False"
                                          />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<My:MyGridView ID="GridView_Volunteers" SkinID="pager" runat="server" DataKeyNames="Id"
    AllowHoverSelect="False" AutoGenerateColumns="False" MySortDirection="Ascending"
    AllowHoverEffect="False" AllowPaging="True" EmptyDataText="<%$ Resources:NoData %>"
    TotalRowCount="0" ShowFooter="True" PageSize="16" AllowSorting="True">
    <FooterStyle HorizontalAlign="Right" />
    <Columns>

       <asp:BoundField  HeaderText="<%$ Resources:VOrganizationID %>" Visible="false" />
        <My:VolunteerIDBoundField DataField="VolunteerID" HeaderText="<%$ Resources:VolunteerID %>"
            ReadOnly="True" SortExpression="VolunteerID" />
        <asp:BoundField DataField="VolunteerName" HeaderText="<%$ Resources:VolunteerName %>"
            ReadOnly="True" SortExpression="VolunteerName"  />
        <asp:BoundField DataField="PersonName" HeaderText="<%$ Resources:PersonName %>"
            ReadOnly="True" Visible="false" />
        <asp:TemplateField HeaderText="<%$ Resources:RegStatus %>">            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# ChangeRegStatus(Eval("RegStatus")) %>'></asp:Label>
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
       
        <asp:TemplateField HeaderText="<%$ Resources:RegStatus %>">
            <ItemTemplate>
                <asp:RadioButtonList ID="RadioButtonList1" runat="server" DataSourceID="SqlDS_RegStatus"
                    DataTextField="theText" DataValueField="theValue" Height="26px" RepeatDirection="Horizontal"
                    SelectedValue='<%# Bind("RegStatus") %>'>
                </asp:RadioButtonList>
                <asp:SqlDataSource ID="SqlDS_RegStatus" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
                    SelectCommand="SELECT [Text] as theText,[Value] as theValue
FROM CodeMapping
WHERE TableName='TrainingRegister' AND ColumnName='RegStatus'"></asp:SqlDataSource>
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
        <asp:TemplateField meta:resourcekey="bfSignIn">
            <HeaderTemplate>
                <asp:Label ID="bfSignIn" runat="server" Text="<%$ Resources:bfSignIn.HeaderText %>"></asp:Label>
                <asp:CheckBox ID="chkAllSignIn" runat="server" OnCheckedChanged="chkAllSignIn_CheckedChanged"
                    AutoPostBack="true" Checked="true"></asp:CheckBox>
            </HeaderTemplate>
            <ItemTemplate>
                <asp:CheckBox ID="chkSignIn" runat="server"></asp:CheckBox>
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
        <asp:TemplateField meta:resourcekey="bfSignOut">
            <HeaderTemplate>
                <asp:Label ID="bfSignOut" runat="server" Text="<%$ Resources:bfSignOut.HeaderText %>"></asp:Label>
                <asp:CheckBox ID="chkAllSignOut" runat="server" OnCheckedChanged="chkAllSignOut_CheckedChanged"
                    AutoPostBack="true" Checked="true"></asp:CheckBox>
            </HeaderTemplate>
            <ItemTemplate>
                <asp:CheckBox ID="chkSignOut" runat="server"></asp:CheckBox>
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
        <asp:TemplateField HeaderText="<%$ Resources:CheckStatus %>" Visible="false">
            <ItemTemplate>
                <asp:CheckBoxList ID="cblCheckStatus" runat="server" OnDataBinding="cblCheckStatus_DataBinding"
                    RepeatDirection="Horizontal">
                    <asp:ListItem>簽到</asp:ListItem>
                    <asp:ListItem>簽退</asp:ListItem>
                </asp:CheckBoxList>
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
        <asp:TemplateField ShowHeader="False">
            <ItemTemplate>
                <asp:LinkButton ID="lbtnUpdate" runat="server" CommandName="Update" Text="<%$ Resources:Update %>"></asp:LinkButton>
            </ItemTemplate>
            <EditItemTemplate>
                &nbsp;
            </EditItemTemplate>
                       <FooterTemplate>
                <asp:Button ID="btnPageUpdate" runat="server" OnClick="btnPageUpdate_Click" Text="<%$ Resources:Update %>" />
            </FooterTemplate>
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
        <asp:TemplateField ShowHeader="False">
            <ItemTemplate>
                <asp:LinkButton ID="lbtnDelete" runat="server" CausesValidation="False" CommandName="Delete"
                    Text="<%$ Resources:Delete %>"></asp:LinkButton>
                <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="<%$ Resources:ConfirmDelete %>"
                    Enabled="True" TargetControlID="lbtnDelete">
                </ajaxToolkit:ConfirmButtonExtender>
            </ItemTemplate>
 
            <ItemStyle HorizontalAlign="Center" />
        </asp:TemplateField>
    </Columns>
</My:MyGridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="BLL_Delete"
    OldValuesParameterFormatString="original_{0}" SelectMethod="BLL_Select" TypeName="BLL_AddTrainingRegister"
    UpdateMethod="BLL_Update">
    <DeleteParameters>
        <asp:Parameter Name="original_Id" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="original_Id" Type="Int32" />
        <asp:Parameter Name="RegStatus" Type="String" />
    </UpdateParameters>
    <SelectParameters>
        <asp:ControlParameter ControlID="ddlGroupId" Name="GroupId" PropertyName="SelectedValue"
            Type="Int32" />
       <%-- <asp:Parameter Name="Region" Type="String" />
        <asp:Parameter Name="Region2" Type="String" />--%>
        <asp:Parameter Name="UOrganizationID" Type="String" />
        <asp:Parameter Name="VOrganizationID" Type="Int32" />
        <asp:Parameter Name="VolunteerId" Type="String" />
        <asp:Parameter Name="VolunteerName" Type="String" />
        <asp:Parameter Name="TEL" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="BLL_SelectActiveVolunteer" TypeName="BLL_AddTrainingRegister">
    <SelectParameters>
        <asp:ControlParameter ControlID="ddlGroupId" Name="GroupId" PropertyName="SelectedValue"
            Type="Int32" />
      <%--  <asp:Parameter Name="Region" Type="String" />
        <asp:Parameter Name="Region2" Type="String" />--%>
         <asp:Parameter Name="UOrganizationID" Type="String" />
        <asp:Parameter Name="VOrganizationID" Type="Int32" />
        <asp:Parameter Name="VolunteerId" Type="String" />
        <asp:Parameter Name="VolunteerName" Type="String" />
        <asp:Parameter Name="TEL" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
<uc1:SearchVolunteerControl ID="SearchVolunteerControl1" runat="server" />
<%--<asp:ValidationSummary ID="vas1" runat="server" ValidationGroup="vPrint" ShowMessageBox="true"
    ShowSummary="false" />
--%>